import request from '@/utils/request';

/**
 * 获取广告数据列表
 * @returns {Promise<any>}
 */
export const getAdver = async (data, page) => {
  const options = {
    params: data,
  };
  return request('/admin/advers?page='+page, options);
};
/**
 * 添加广告数据列表
 * @returns {Promise<any>}
 */
export const addAdverData = async (data) => {
  return request.post('/admin/advers', {data});
};
/**
 * 获取广告的详情
 * @returns {Promise<any>}
 */
export const getAdverDetail = async (id) => {
  return request(`/admin/advers/${id}`);
};
/**
 * 修改广告的详情
 * @returns {Promise<any>}
 */
export const editAdver = async (id, data) => {
  return request.put(`/admin/advers/${id}`, { data });
};
/**
 * 修改广告的状态
 * @returns {Promise<any>}
 */
export const editAdverStatus = async (advice) => {
  return request.patch(`/admin/advers/${advice}/status`);
};
/**
 * 修改广告的位置
 * @returns {Promise<any>}
 */
export const editAdverSeq = async (advice) => {
  return request.patch(`/admin/advers/${advice}/seq`);
};
/**
 * 修改广告的顺序
 * @returns {Promise<any>}
 */
export const editSeqAdver = async (advice) => {
  return request.patch(`/admin/advers/${advice}/status`);
};
/**
 * 删除广告数据列表
 * @returns {Promise<any>}
 */
export const delAdver = async (id) => {
  return request.delete(`/admin/advers/${id}`);
};
